package com.ysd.dao.impl;

import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.List;

import com.ysd.entity.Danner;
import com.ysd.uitl.DBManager;

public class DannerDaoImpl {
	public List<Danner> getDannerList(){
		List<Danner> list=new ArrayList<Danner>();
				Connection	conn=DBManager.getConnection();
				Statement st=null;
				ResultSet rs=null;
				try {
					st=conn.createStatement();
					rs=st.executeQuery("select d.bannerId,d.bannerImg from banner d");
					while(rs.next()) {
						int bannerId=rs.getInt("bannerId");
						String bannerImg=rs.getString("bannerImg");
						Danner d=new Danner(bannerId, bannerImg);
						list.add(d);
						
					}
					return list;
				} catch (SQLException e) {
					// TODO: handle exception
					return null;
				}finally {
					DBManager.closeAll(conn, st, rs);
				}
	}
}
